package cn.tedu.tmall.admin.content.controller;


import cn.tedu.tmall.admin.content.pojo.param.ArticleAddParam;
import cn.tedu.tmall.admin.content.service.IArticleService;
import cn.tedu.tamll.common.web.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/articles")
@Api(tags = "文章接口")
@Validated
@Slf4j
public class ArticleController {
    @Autowired
    private IArticleService articleService;
    @ApiOperation("增加文章")
    @PostMapping("/add")
    public JsonResult add(@Validated @RequestBody ArticleAddParam articleAddParam) {
        articleService.add(articleAddParam);
        return JsonResult.ok("添加成功");
    }

}
